package com.itheima.app.manager;

import com.itheima.app.interceptor.UserHolder;
import com.itheima.feign.DbServiceFeign;
import com.itheima.vo.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@RequiredArgsConstructor
public class TestSoulManager {

    private final DbServiceFeign dbServiceFeign;

    public List<TopicVo> search() {
        return dbServiceFeign.findTopics();
    }

    public Long submit(AnswersVo answersVo) {
        answersVo.setUserId(UserHolder.get().getId());
        Long submit =dbServiceFeign.submit(answersVo);
        return  submit;
    }

    public ReportVo queryResult(Long id) {
        return dbServiceFeign.queryResult(id);
    }
}
